/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import {
  Form, Input, Radio, Select, Icon,
  DatePicker, TreeSelect,
} from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
const FormItem = Form.Item;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const TreeNode = TreeSelect.TreeNode;
@connect(({ inner_address_book, loading, global }) => ({
  inner_address_book,
  global,
  loading: loading.models.inner_address_book,
}))
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      fileList:[]
    };
  }

  componentDidMount() {
  }
  render() {
    const {
      inner_address_book: { organizationData,loading, tableY, meta, searchParams, selectedRowKeys },
    } = this.props;
    console.log('organizationData',organizationData)
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 6},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };

    const {getFieldDecorator} = this.props.form;
    return (
      <div>
        <Form onSubmit={this.handleSubmit}>
          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
               离职员工
            </span>
            )}
          >
            {getFieldDecorator('name', {
              initialValue: this.props.editRecord?this.props.editRecord.name:'',
              rules: [{ required: true, message: '' }],
            })(
              <Input disabled={true}/>
            )}
          </FormItem>
          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
               离职原因
            </span>
            )}
          >
            {getFieldDecorator('resign_reason', {
              initialValue: '个人原因',
              rules: [{ required: true, message: '' }],
            })(
              <Select>
                <Option value={'个人原因'}>个人原因</Option>
                <Option value={'合同到期不续签'}>合同到期不续签</Option>
                <Option value={'其它'}>其它</Option>
                <Option value={'协议解除'}>协议解除</Option>
                <Option value={'无法胜任工作'}>无法胜任工作</Option>
                <Option value={'经济性裁员'}>经济性裁员</Option>
                <Option value={'严重违法违纪'}>严重违法违纪</Option>
              </Select>
            )}
          </FormItem>
          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
               离职日期
            </span>
            )}
          >
            {getFieldDecorator('date', {
              initialValue: moment(),
              rules: [{ required: true, message: '' }],
            })(
             <DatePicker allowClear={false} style={{width:'100%'}}/>
            )}
          </FormItem>
          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
               离职备注
            </span>
            )}
          >
            {getFieldDecorator('remark', {
              initialValue:'',
            })(
              <Input />
            )}
          </FormItem>
        </Form>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default AddPoliciesFormWrap;


